﻿using System;
using System.Collections.Generic;
using System.Web.UI;
using EPiServer.Core;
using OpenWaves.EPiServer;
using OpenWaves.Pagination;

namespace $rootnamespace$.Views.Pages
{
    public partial class PaginatedPageTemplate : Page
    {
        protected PaginationViewModel<PageData> Pagination;

		protected IEnumerable<PageData> AllItems
		{
			get 
			{ 
				//
				// This is where you can specify what you want to paginate over
				//

				return PageReference.StartPage.GetChildren(); 
			}
		}

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

			var paginationController = new PaginationController(Request)
			{ 
				ItemsPerPage = 10,	// Default
				MaxNumberOfPagesToShow = 5	// Default
			};

            this.Pagination = paginationController.Paginate(this.AllItems);

			this.DataBind();
        }
    }
}